package per.turtle.system.feign.fallback;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import per.turtle.common.core.web.entity.CommonResult;
import per.turtle.system.dto.SysFile;
import per.turtle.system.feign.RemoteFileService;

/**
 * 文件服务降级处理
 *
 * @author turtle
 */
@Slf4j
@Component
public class RemoteFileFallbackImpl implements RemoteFileService {

    @Setter
    private Throwable cause;

    @Override
    public CommonResult<SysFile> upload(MultipartFile file, boolean isPub) {
        log.error("文件服务调用失败:{}", cause.getMessage());
        return CommonResult.error("上传文件失败:" + cause.getMessage());
    }

}
